/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType; 
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;

/**
 *
 * @author Jacko
 */
@Entity
public class Stakeholder implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long StakeID; 
    private String  username;
    private String  password; 
    private long    registeredDate;
    private int     numberOfAdClicks; 
    private double   revenue; 
    

    @OneToOne(targetEntity=ServicePlan.class, cascade={CascadeType.ALL}, 
            fetch = FetchType.EAGER)
    private ServicePlan servicePlan; 
    
    @OneToMany(targetEntity=Transactions.class, cascade={CascadeType.ALL}, 
            fetch = FetchType.EAGER, mappedBy="stakeholder")
    private Collection<Transactions> transactions = new ArrayList<Transactions>(); 
    
    
    
    public Long getStakeID() {
        return StakeID;
    }

    public void setStakeID(Long StakeID) {
        this.StakeID = StakeID;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public long getRegisteredDate() {
        return registeredDate;
    }

    public void setRegisteredDate(long registeredDate) {
        this.registeredDate = registeredDate;
    }

    public ServicePlan getServicePlan() {
        return servicePlan;
    }

    public void setServicePlan(ServicePlan servicePlan) {
        this.servicePlan = servicePlan;
    }

    public Collection<Transactions> getTransactions() {
        return transactions;
    }

    public void setTransactions(Collection<Transactions> transactions) {
        this.transactions = transactions;
    }

    public int getNumberOfAdClicks() {
        return numberOfAdClicks;
    }

    public void setNumberOfAdClicks(int numberOfAdClicks) {
        this.numberOfAdClicks = numberOfAdClicks;
    }

    public double getRevenue() {
        return revenue;
    }

    public void setRevenue(int revenue) {
        this.revenue = revenue;
    }
    
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (getStakeID() != null ? getStakeID().hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Stakeholder)) {
            return false;
        }
        Stakeholder other = (Stakeholder) object;
        if ((this.getStakeID() == null && other.getStakeID() != null) || (this.getStakeID() != null && !this.StakeID.equals(other.StakeID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Stakeholder[ id=" + getStakeID() + " ]";
    }



}
